<?php echo $this->Session->flash(); ?>


<h1>FILTRO ASPIRANTES PROYECTO <?php echo$cod; ?></h1>
<br>
<br>
<div id="loading" style="display: none;">
    <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
</div>
<table border="0" width="30%">

    <tbody>
        <tr>
            <td style="color: #9c7854" width="70%" >Cabeza de familia</td>
            <td style="background-color:#CFE6CF;" width="30%"></td>
        </tr>
        <tr>
            <td style="color: #9c7854" width="70%">Conyugue</td>
            <td style="background-color:#e3dede" width="30%" ></td>
        </tr>
    </tbody>
</table>





<table  class="tb" >
    <thead>
        <tr style="background-color:#CFE6CF; color: #9c7854">

            <th>Proyecto</th>
            <th>Documento</th>
            <th>Primer nombre</th>
            <th>Segundo nombre</th>
            <th>Primer Apellido</th>
            <th>Segundo Apellido</th>
            <th>Tipo</th>
            <th colspan="3">Opciones</th>
        </tr>
    </thead>
    <tbody>

        <?php foreach ($titulares as $ben): ?>

            <?php
            switch ($ben['Candidate']['tipo']) {
                case 2:
                    $tp = "Campesino";
                    break;
                case 3:
                    $tp = "Cumple";
                    break;
                case 4:
                    $tp = "Desplazado";
                    break;
                case 5:
                    $tp = "Profesional";
                    break;

                default:
                    $tp = "";
                    break;
            }
            ?>
            <tr style="background-color:#CFE6CF">

                <td><?php echo $cod ?></td>
                <td><?php echo $ben['Candidate']['nro_ident'] ?></td>
                <td><?php echo $ben['Candidate']['1er_nombre'] ?></td>
                <td><?php echo $ben['Candidate']['2do_nombre'] ?></td>
                <td><?php echo $ben['Candidate']['1er_apellido'] ?></td>
                <td><?php echo $ben['Candidate']['2do_apellido'] ?></td>
                <td><?php echo $tp ?></td>

                <td><?php echo $ajax->link("Filtro operativo", array('controller' => 'CandidateRequirements', "action" => "index", $ben['Candidate']['id']), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading')) ?></td>
                <td></td>
                <td></td>
            </tr>
    <?php foreach ($conyugues as $con): ?>
        <?php if ($con['Candidate']['candidate_id'] == $ben['Candidate']['id']): ?>

            <?php
            switch ($con['Candidate']['tipo']) {
                case 6:
                    $tp1 = "Conyugue campesino";
                    break;
                case 7:
                    $tp1 = "Conyugue desplazado";
                    break;
                case 8:
                    $tp1 = "Conyugue Profesional";
                    break;
            }
            ?>

                    <tr style="background-color:#e3dede">

                        <td><?php echo $cod ?></td>
                        <td><?php echo $con['Candidate']['nro_ident'] ?></td>
                        <td><?php echo $con['Candidate']['1er_nombre'] ?></td>
                        <td><?php echo $con['Candidate']['2do_nombre'] ?></td>
                        <td><?php echo $con['Candidate']['1er_apellido'] ?></td>
                        <td><?php echo $con['Candidate']['2do_apellido'] ?></td>
                        <td><?php echo $tp1 ?></td>
                        <td><?php echo $ajax->link("Filtro operativo", array('controller' => 'CandidateRequirements', "action" => "index", $con['Candidate']['id']), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading')) ?></td>
                        <td></td>
                        <td></td>
                    </tr>
        <?php endif; ?>
    <?php endforeach; ?>
<?php endforeach; ?>
    </tbody>
</table>
<br>
<br>
<legend><?php echo $ajax->link("Agregar Aspirante ", array('controller' => 'Candidates', "action" => "add"), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading')) ?></legend>





